package com.ExceptionPWTest;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWTest {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.println("请输入");
            String s = sc.nextLine();
            if ("exit".equals(s)){
                break;
            }
            pw.println(s);
        }
        pw.close();
        System.out.println("输入结束");

    }
}
